import re
import subprocess

retcode = subprocess.call(["cmd", "/C", "dumpbin /symbols Library_VC++\Debug\AdderEngine.lib > symbolslog.txt"]);

f = open("symbolslog.txt")
text = f.read()
f.close()

res = re.findall("\?do_([^ ]*?)Z ", text)

print "bytecodes.inc:"
for i in res:
	print "EXTERNDEF ?do_" + i + "Z:NEAR"

print ""
print "compiler.py mappings:"
for i in res:
	a = i.split("@")[0]
	print "\"" + a + "\": \"?do_" + i + "Z\","

res = re.findall("\?engine_([^ ]*?)Z ", text)

print ""
print "bytecodes.inc:"
for i in res:
	print "EXTERNDEF ?engine_" + i + "Z:NEAR"